package com.team2.s3hrjyxm.dao;

import com.team2.s3hrjyxm.pojo.Role;
import com.team2.s3hrjyxm.pojo.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;
@Mapper
public interface UsersDao {
     @Select("select u.u_id,u.u_name,u.u_true_name,u.u_password,r.role_name from users u inner join role  r on u.u_role_id=r.role_id")
     public List<Map> userquery();
     @Select("select * from role")
     public List<Role> yhsfquery();
     @Insert("insert into users(u_name,u_true_name,u_password,u_role_id) values(#{u_name},#{u_true_name},#{u_password},#{u_role_id}) ")
     public int useradd(Users r);
     @Select("select u.u_id,u.u_name,u.u_true_name,u.u_password,r.role_name from users u inner join role  r on u.u_role_id=r.role_id where u.u_id=#{value}" )
     Map userquerybyid(int u_id);
     @Delete("delete from users where u_id=#{value}")
     void userdelete(int u_id);
     @Update("update users set u_name=#{u_name},u_true_name=#{u_true_name},u_password=#{u_password},u_role_id=#{u_role_id} where u_id=#{u_id}")
     void userupdate(Users u);
}
